/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package Other;

import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.security.NoSuchAlgorithmException;
import javax.crypto.KeyGenerator;
import javax.crypto.SecretKey;

/**
 *
 * @author Envy
 */
public class CreateSecretKey {

    private SecretKey CreateSecretKey() throws NoSuchAlgorithmException, FileNotFoundException, IOException {
        SecretKey secret = null;
        KeyGenerator keygenerator = KeyGenerator.getInstance("DES");
        secret = keygenerator.generateKey();

        FileOutputStream fout = null;
        fout = new FileOutputStream("secret");
        fout.write(secret.getEncoded());
        fout.close();

        return secret;
    }
}
